<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
		<meta content="yes" name="apple-mobile-web-app-capable" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style" />
		<meta content="telephone=no" name="format-detection" />
		<title>高仿红星二锅头防伪查询系统</title>
		<script crossorigin="anonymous" integrity="sha512-BKbSR+cfyxLdMAsE0naLReFSLg8/pjbgfxHh/k/kUC82Hy7r6HtR5hLhobaln2gcTvzkyyehrdREdjpsQwy2Jw=="
		 src="//lib.baomitu.com/vue/2.6.12/vue.min.js"></script>
		<script crossorigin="anonymous" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg=="
		 src="//lib.baomitu.com/jquery/3.5.1/jquery.min.js"></script>

		<style>
			input {
				-webkit-appearance: none;
				/*去除input默认样式*/
			}

			button {
				-webkit-appearance: none;
				/*去除input默认样式*/
			}

			a {
				color: black;
				text-decoration: none;
			}

			body {
				font-size: 14px;
				font-family: Arial;
				padding: 0px;
				margin: 0px;
				background-color: #fff;
			}

			#bdiv a {
				display: inline-block;
				width: 30%;
			}

			#bdiv a img {
				width: 100%;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<div id="tdiv">
				<div>
					<img src="img/20201203170441289901.jpg" style=" width:100%" />
				</div>
				<div v-if="!info.isOut" style="width: 100%; max-height: 292px; position: absolute; height: 30%; min-height: 180px;
            text-align: -webkit-center;">
					<div style="text-align: left; width: 82%; background-size: contain; border-radius: 5px;
                font-size: 16px; height: 100%; overflow: scroll; padding: 0px 0px; border: 1px solid #ccc;
                background-color: #f9f9f9;">
						<div v-if="info.count > 1">
							您所查询的是红星二锅头正牌产品编码，谢谢查询！<br />
							该编码已被查询，现在是<span style="color: Red;" v-text="'第'+info.count+'次'"></span>查询。<br />
							查询记录：<br />
							<div v-for="(i,index) in info.count">
								<span v-if='index==0' style="color:red;" v-text="info.times[index]+ ', 首次查询。查询方式：二维码查询'"></span>
								<span v-else v-text="info.times[index]+', 第'+i+'次查询。查询方式：二维码查询'"></span>
							</div>
						</div>
						<div v-else>
							您所查询的是红星二锅头正牌产品编码，谢谢查询！<br />
						</div>
					</div>
				</div>
				<div v-if="info.isOut" style="width: 100%; max-height: 292px; position: absolute; height: 30%; min-height: 180px;
			text-align: -webkit-center;">
					<div style="text-align: left; width: 82%; background-size: contain; border-radius: 5px;
			    font-size: 16px; height: 100%; overflow: scroll; padding: 0px 0px; border: 1px solid #ccc;
			    background-color: #f9f9f9;">
						<div v-if="info.count > 1">
							<div v-text="'编码：'+info.sc"></div>
							<div>
								产品名称：D79-43度红星二锅头酒（绵柔纯粮-250mL）【蓝瓶】<br />您扫描的是盖外二维码，请拧开瓶盖并扫描盖内二维码查询真伪。
							</div>
							<div v-text="'现在是第'+info.count+'次查询。'"></div>
							<div>查询记录：</div>
							<div v-for="(i,index) in info.count">
								<span v-text="i+'、'+ info.times[index]+', 第'+i+'次查询。'"></span>
							</div>
							<div>
								该编码对应的防伪码已被查询，谨防假冒，如需进一步查询或协助，请于周一至周五09:00-18:00期间致电防伪查询电话18888888888进行确认与举报。感谢您的配合！<br />
							</div>
						</div>

						<div v-else>
							您所查询的是红星二锅头正牌产品编码，谢谢查询！<br />
						</div>
					</div>
				</div>
			</div>
			<div id="bdiv" style="position: absolute; bottom: 10px; width: 100%;text-align: center">
				<a href="http://www.redstarwine.com">
					<img src="img/commond_btn_pinpaigw.png" />
				</a>
				<a href="http://him56.com/hx/GFWeixin/1">
					<img src="img/commond_btn_gongzhongh.png" />
				</a>
				<a @click="scanQRCode">
					<img src="img/commond_btn_saoyisao.png" />
				</a>
				<div style="color: gray;">
					本网页为高度仿制红星二锅头防伪系统，侵删
				</div>
			</div>
		</div>
	</body>
</html>
<script>
	var sc = GetUrlParam('sc');

	var vue = new Vue({
		el: '#app',
		data: {
			info: {
				sc: '',
				isOut: true,
				count: 0,
				times: [],
			}
		},
		methods: {
			onload: function() {
				var infoStr = localStorage.getItem(sc);
				if (infoStr) {
					this.info = JSON.parse(infoStr);
					this.info.isOut = (Number(sc.substr(0, 1)) != 0);
					this.info.count++;
					var time = dateFormat("yyyy/MM/dd HH:mm:ss", new Date());
					this.info.times.push(time);
					infoStr = JSON.stringify(this.info);
					localStorage.setItem(sc, infoStr);
				} else {
					this.info.sc = sc;
					this.info.isOut = (Number(sc.substr(0, 1)) != 0);
					this.info.count = 1;
					var time = dateFormat("yyyy/MM/dd HH:mm:ss", new Date());
					this.info.times = [];
					this.info.times.push(time);
					infoStr = JSON.stringify(this.info);
					localStorage.setItem(sc, infoStr);
				}

			},
			scanQRCode: function() {
				var ua = navigator.userAgent.toLowerCase();
				var url = window.location.href;
				if (url.indexOf("?") != -1) {
					url = url.split("?")[0];
				}
				url = url + "?sc=";
				window.location.href = "http://wx.4000851315.com/wchat/jsapi/index?type=scode&url=" + encodeURIComponent(url);
				                     //"http://wx.4000851315.com/wchat/jsapi/index?type=scode&url=" + encodeURIComponent(url);
			}
		},
		mounted: function() {
			this.onload();
		}
	});

	function GetUrlParam(paraName) {
		var reg = new RegExp("(^|&)" + paraName + "=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if (r != null) return unescape(r[2]);
		return null;
	}

	function dateFormat(fmt, date) {
		let ret;
		const opt = {
			"y+": date.getFullYear().toString(), // 年
			"M+": (date.getMonth() + 1).toString(), // 月
			"d+": date.getDate().toString(), // 日
			"H+": date.getHours().toString(), // 时
			"m+": date.getMinutes().toString(), // 分
			"s+": date.getSeconds().toString() // 秒
			// 有其他格式化字符需求可以继续添加，必须转化成字符串
		};
		for (let k in opt) {
			ret = new RegExp("(" + k + ")").exec(fmt);
			if (ret) {
				fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
			};
		};
		return fmt;
	}
</script>
